<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>使用媒体查询，重新排列在指定屏幕尺寸下的顺序</title>
    <style>
        /* 使用媒体查询，重新排列在指定屏幕尺寸下的顺序 */
        .grid-container {
            display: grid;
            grid-template-columns: auto auto auto;
            grid-gap: 10px;
            background-color: #2196F3;
            padding: 10px;
        }

        .grid-container>div {
            background-color: rgba(255, 255, 255, 0.8);
            text-align: center;
            padding: 20px 0;
            font-size: 30px;
        }

        @media only screen and (max-width: 500px) {
            .item1 {
                grid-area: 1 / span 3 / 2 / 4;
            }

            .item2 {
                grid-area: 3 / 3 / 4 / 4;
            }

            .item3 {
                grid-area: 2 / 1 / 3 / 2;
            }

            .item4 {
                grid-area: 2 / 2 / span 2 / 3;
            }

            .item5 {
                grid-area: 3 / 1 / 4 / 2;
            }

            .item6 {
                grid-area: 2 / 3 / 3 / 4;
            }
        }
    </style>
</head>

<body>

    <h1>不同设备上不同布局</h1>

    <p>重置浏览器大小，查看效果。</p>

    <div class="grid-container">
        <div class="item1">1</div>
        <div class="item2">2</div>
        <div class="item3">3</div>
        <div class="item4">4</div>
        <div class="item5">5</div>
        <div class="item6">6</div>
    </div>

</body>

</html>